import os
from django.conf.urls import patterns, url
import views
from .views import (PublisherListView,
                    PublisherDetailView,
                    PublisherBookList,
                    BookListView,
                    BookDetailView,
                    AuthorListView,
                    AuthorDetailView,
                    AuthorCreateView,
                    AuthorUpdateView,
                    AuthorDeleteView,
                    MyCustomView,
                    MyCustomView2,
                    AboutView,
                    directory_index_my,
)

urlpatterns = patterns(
    '',
    url(r'^publishers/$',
        PublisherListView.as_view(),
        name="publisher_list"),
    url(r'^publisher/(?P<pk>\d+)/$',
        PublisherDetailView.as_view(),
        name="publisher_detail"),
    url(r'^publisherbook/([\w-]+)/$',
        PublisherBookList.as_view(),
        name="publisher_book"),
    # url(r'^publisherbook/([\w-]+)/(\d+)/$',
    #     PublisherBookList.as_view(),
    #     name="publisher_book"),
    url(r'^books/$',
        BookListView.as_view(),
        name="books_all"),
    url(r'^book/(?P<pk>\d+)/$',
        BookDetailView.as_view(),
        name="book_detail"),
    url(r'^authors/$',
        AuthorListView.as_view(),
        name="author_list"),
    # url(r'^author/\d+/author_headshots/(?P<path>.*)$',
    #     'django.views.static.serve',
    #     {'document_root': STATICFILES_DIRS[0]}),
    url(r'^author/(?P<pk>\d+)/$',
        AuthorDetailView.as_view(),
        name="author_detail"),
    url(r'^author/add/$',
        AuthorCreateView.as_view(),
        name="author_add"),
    url(r'^author/(?P<pk>\d+)/update/$',
        AuthorUpdateView.as_view(),
        name="author_update"),
    url(r'^author/(?P<pk>\d+)/delete/$',
        AuthorDeleteView.as_view(),
        name="author_delete"),
    url(r'^testcbv/$',
        MyCustomView.as_view(),
        kwargs={},
        name="testcbv"),
    url(r'^inheritance1/$',
        views.Inheri1MyCustomView.as_view(),
        name="inheri1"),
    url(r'^homepage/$',
        views.HomePageView.as_view(),
        name="homepage"),
   url(r'^testcbv2/$',
        MyCustomView2.as_view(),
        kwargs={},
        name="testcbv2"),
    url(r'^about/$',
        AboutView.as_view(),
        name="about"),
    url(r'^testcbv/(?P<age>\d+)/$',
        MyCustomView.as_view(),
        kwargs={},
        name="test_view"),
    url(r'^viewfun/$',
        'books.views.viewfun',
        name="viewfun"),
    url(r'^dir_index/$',
        directory_index_my,
        name="dir_index"),
)
